<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Unit Tests for Pagination class</title>
		<script type="text/javascript" src="../lib/jsunit/app/jsUnitCore.js"></script>
		<script type="text/javascript" src="../pagination.js"></script>
		<script type="text/javascript">
			function testPageCountIsCorrect() {
				var p = new Pagination(10, 121);
				assertEquals(13, p.num_pages());
			}
			
			function testGetIntervalWithCurrentpageIsFirst(){
				var p = new Pagination(10, 300);
				p.current_page = 0;
				assertArrayEquals([0,10], p.getInterval());
			}
			
			function testGetIntervalWithCurrentpageFive(){
				var p = new Pagination(10, 300);
				p.current_page = 5;
				assertArrayEquals([0,15], p.getInterval());
			}
			
			function testGetIntervalWithCurrentpageFivteen(){
				var p = new Pagination(10, 300);
				p.current_page = 15;
				assertArrayEquals([5,25], p.getInterval());
			}
			
			function testGetIntervalWithCurrentpageTwentyfive(){
				var p = new Pagination(10, 300);
				p.current_page = 25;
				assertArrayEquals([15,30], p.getInterval());
			}
			
			function testGetIntervalWithCurrentpageIsLast(){
				var p = new Pagination(10, 300);
				p.current_page = 30;
				assertArrayEquals([20,30], p.getInterval());
			}
			
		</script>
	</head>
	<body>
	</body>
</html>
